package com.hmdp.utils;


import com.hmdp.dto.UserDto;

/**
 * @author 10550
 * @desc User ThreadLocal
 */
public class UserHolder {
    private static final ThreadLocal<UserDto> THREAD_LOCAL = new ThreadLocal<>();

    public static void saveUser(UserDto user) {
        THREAD_LOCAL.set(user);
    }

    public static UserDto getUser() {
        return THREAD_LOCAL.get();
    }

    public static void removeUser() {
        THREAD_LOCAL.remove();
    }
}
